package com.guigu.gulicommon.entity.dto;

import com.guigu.gulicommon.api.PageQueryParameters;
import lombok.*;
import lombok.experimental.Accessors;

import static com.guigu.gulicommon.constant.CheckParametersConstant.PAGE_NUM_DEFAULT_VALUE;
import static com.guigu.gulicommon.constant.CheckParametersConstant.PAGE_SIZE_DEFAULT_VALUE;

/**
 * @author 陈俊杰
 * @version 1.0
 * @since 2024/9/23 10:45
 */
@Builder
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SelectSkuInfoPagesDto implements PageQueryParameters {

    /**
     * 模糊查询参数
     */
    private String queryParam;


    private Long pageNum;


    private Long pageSize;

    @Override
    public Long getPageNum() {
        return pageNum;
    }

    @Override
    public void setPageNum(Long pageNum) {

        if (pageNum == null || pageNum <= 0L) {
            pageNum = PAGE_NUM_DEFAULT_VALUE;
        }
        this.pageNum = pageNum;
    }

    @Override
    public Long getPageSize() {
        return pageSize;
    }


    @Override
    public void setPageSize(Long pageSize) {
        if (pageSize == null || pageSize <= 1L) {
            pageSize = PAGE_SIZE_DEFAULT_VALUE;
        }
        this.pageSize = pageSize;
    }
}
